package com.tbit.uqbike.object.business;

import com.tbit.uqbike.object.pojo.Account;
import com.tbit.uqbike.object.pojo.MachineShortInfo;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @author MyWin E-mail:335918956@qq.com
 * @version 1.0
 * @createTime 2019-12-28 16:30
 * 用户所能查看的所有的设备信息
 */
public class User2Machine {
    public Account account;
    public List<MachineShortInfo> machines = new LinkedList<>();

    Map<String, MachineShortInfo> codeMap;

    public Map<String, MachineShortInfo> getCodeMap() {
        if (null == codeMap) {
            Map<String, MachineShortInfo> temp = new HashMap<>();
            for (MachineShortInfo item : machines) {
                temp.put(item.getUserCode(), item);
            }
            codeMap = temp;
        }
        return codeMap;
    }
}
